﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;

using System.Configuration;
using SystemBLL;

namespace SystemUI
{
    static class Program
    {
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            //Application.Run(new frmLogin());
            //判断是否出现登录窗口
            string loginStr = ConfigurationManager.AppSettings["Login"];
            switch (loginStr)
            {
                case "Login":
                    if (new frmLogin().ShowDialog() == DialogResult.OK)
                    {
                        Application.Run(new frmMain(frmLogin._user));
                        frmLogin._user.UserStatus = 0;
                        if (new UserBLL().ChangeUser(frmLogin._user))
                            Application.Exit();
                    }
                    break;
                case "noLogin":
                    Application.Run(new frmMain());
                    break;
                default:
                    if (new frmLogin().ShowDialog() == DialogResult.OK)
                    {
                        Application.Run(new frmMain(frmLogin._user));
                    }
                    break;
            }
        }
    }
}
